﻿using ITPaloozaPCL.Interfaces;
using ITPaloozaPCL.PCL.Service;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ITPaloozaPCL.WinPhone8App.ViewModels
{
    public class MainViewModel : INotifyPropertyChanged
    {
        #region Fields

        #endregion

        #region Properties
        private ObservableCollection<IStock> _PriceList;
        public ObservableCollection<IStock> PriceList { get { return _PriceList; } }
        #endregion

        #region Ctors
        public MainViewModel()
        {
            _PriceList = new ObservableCollection<IStock>();
            InitializeDataContext();
        }
        #endregion

        #region Public
        #endregion

        #region Private
        private void InitializeDataContext()
        {
            DataService service = new DataService();
            string[] symbols = new string[] { "AA", "BB", "CC", "DD", "EE" };
            foreach (string symbol in symbols)
            {
                var priceList = service.GetPriceList(symbol, 20);
                foreach (var stock in priceList)
                    PriceList.Add(stock);
            }
        }
        #endregion

        #region INotifyPropertyChanged
        public event PropertyChangedEventHandler PropertyChanged;
        #endregion

    }
}
